# 封装DBshop的业务功能，例如：登录，注册，添加购物车...
from selenium.webdriver.common.by import By
from comm.page import *

class DBshop(Public):
    # 登录
    @classmethod
    def login(self,dr,username,password):
        dr.find_element(*self.Link_login).click()
        dr.find_element(*self.input_account).send_keys(username)
        dr.find_element(*self.input_password).send_keys(password)
        dr.find_element(*self.button_login).click()

    @classmethod
    def register(self,dr,r_name,r_password,r_mail):
        dr.find_element(*self.link_register).click()
        dr.find_element(*self.register_name).send_keys(r_name)
        dr.find_element(*self.register_password).send_keys(r_password)
        dr.find_element(*self.re_password).send_keys(r_password)
        dr.find_element(*self.register_email).send_keys(r_mail)
        dr.find_element(*self.register_agreement).click()
        dr.find_element(*self.register_agree).click()
        dr.find_element(*self.quit).click()